package com.yibing.test.socketchannel;

import java.nio.ByteBuffer;

public abstract class Service {

	// The ID of the service. It consists of two parts: a module ID and a thread ID
	// module ID and thread ID are both short, and serviceID is calculated as following:
	// service id = module id << 16 | thread ID 
	private final long serviceID;
	
	public Service(long ID) {
		serviceID = ID;
	}

	public long getServiceID() {
		return serviceID;
	}
	
	public abstract int onNewMessage(ByteBuffer buf);
}
